
package week04;
   import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class TextScanner1 {

  private static void readFile(String fileName) {
      String temp =new String();
      String user =new String();
    try {
      File file = new File(fileName);
      Scanner  fisier = new Scanner(file);
      Scanner tastatura=new Scanner(System.in);
      fisier .useDelimiter(System.getProperty("line.separator"));


      user = tastatura.next();

      while (fisier.hasNext()) {
          temp = fisier.next();
    if(temp == user){
        temp = fisier.next();
        System.out.println(temp);
    }
      }
      fisier.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }

  public static void main(String[] args) {
    if (args.length != 1) {
      System.err.println("usage: java TextScanner1"
        + "file location");
      System.exit(0);
    }
    readFile(args[0]);
  }
}



